home *** CD-ROM | disk | FTP | other *** search
- unit HiddenMenus;
-
- {$ifdef Ver100} { Delphi 3.0x }
- {$define DelphiLessThan4}
- {$endif}
- {$ifdef Ver110} { C++ Builder 3.0x }
- {$define DelphiLessThan4}
- {$endif}
-
- {$ifndef DelphiLessThan4}
- 'Only for Delphi 3'
- {$endif}
- interface
-
- procedure Register;
-
- implementation
-
- uses
- Forms, CommonStuff, Menus, SysUtils, Dialogs;
-
- type
- THiddenMenus = class(TObject)
- private
- FCompError,
- FViewAsText,
- FUsingHelp,
- FAPI: TMenuItem;
- public
- constructor Create;
- destructor Destroy; override;
- procedure Setup;
- procedure TidyUp;
- end;
-
- const
- //Hidden menu item components
- SCompError = 'SearchCompErrItem';
- SViewAsText = 'ViewSwapSourceFormItem';
- SUsingHelp = 'HelpUsingHelpItem';
- SAPI = 'HelpAPIItem';
-
- constructor THiddenMenus.Create;
- begin
- inherited Create;
- end;
-
- destructor THiddenMenus.Destroy;
- begin
- TidyUp;
- inherited Destroy
- end;
-
- procedure THiddenMenus.Setup;
- begin
- //This section just displays some normally hidden menu items
- FCompError := GetComponent(Application.MainForm, SCompError, SGenericError + SCompError)
- as TMenuItem; //Search | Show Last Compile Error
- FViewAsText := GetComponent(Application.MainForm, SViewAsText, SGenericError + SViewAsText)
- as TMenuItem; //View | View as Text
- FUsingHelp := GetComponent(Application.MainForm, SUsingHelp, SGenericError + SUsingHelp)
- as TMenuItem; //Help | How to Use Help
- FAPI := GetComponent(Application.MainForm, SAPI, SGenericError + SAPI)
- as TMenuItem; //Help | Windows API
- FCompError.Visible := True;
- FViewAsText.Visible := True;
- FUsingHelp.Visible := True;
- FAPI.Visible := True;
- end;
-
- procedure THiddenMenus.TidyUp;
- begin
- //Put menus back to default hidden state
- FCompError.Visible := False;
- FViewAsText.Visible := False;
- FUsingHelp.Visible := False;
- FAPI.Visible := False;
- end;
-
- var
- HiddenMenusObject: THiddenMenus;
-
- procedure Register;
- begin
- HiddenMenusObject.Setup
- end;
-
- initialization
- try
- HiddenMenusObject := THiddenMenus.Create
- except
- on E: Exception do
- ShowMessage(SSetupError + ': ' + E.Message)
- end;
- finalization
- HiddenMenusObject.Free
- end.
-